<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<link rel="stylesheet" type="text/css" href="${path}/css/system/upload.css">
<script type="text/javascript" src="${path}/js/system/account.js"></script>
<script type="text/javascript">
$.ajaxSetup({
    async : false  
}); 
	$(function() {
		
// 		loadResidence("${account.residenceId}");
// 		loadBuilding("${account.residenceId}","${account.buildingId}");
// 		loadUnit("${account.buildingId}","${account.unitId}");
// 		loadDoor("${account.unitId}","${account.doorId}");
		
		
		$('#form').form({
			url : '/account/edit',
			onSubmit : function() {
				parent.$.messager.progress({
					title : '提示',
					text : '数据处理中，请稍后....'
				});
				var isValid = $(this).form('validate');
				if (!isValid) {
					parent.$.messager.progress('close');
				}
				return isValid;
			},
			success : function(result) {
				parent.$.messager.progress('close');
				result = $.parseJSON(result);
				parent.$.messager.alert("提示",result.msg,"info");
				if (result.success) {
					parent.$.modalDialog.openner_dataGrid.datagrid('reload');//之所以能在这里调用到parent.$.modalDialog.openner_treeGrid这个对象，是因为resource.jsp页面预定义好了
					parent.$.modalDialog.handler.dialog('close');
				}
			}
		});
		parent.$.messager.progress('close');
		loadUploadChange();
		loadAccountType();
		$("#typeId").combobox("setValue","${account.typeId}");
	});
</script>
<div class="easyui-layout" data-options="fit:true,border:false">
	<div data-options="region:'center',border:false" title="" style="overflow: auto;">
		<form id="form" method="post" enctype="multipart/form-data">
			<input type="hidden" name="id" value="${account.id }"/>
			<table class="table table-hover table-condensed">
<!-- 				<tr> -->
<!-- 					<td>小区</td> -->
<!-- 					<td><input id="residenceId" name="residenceId" /></td> -->
<!-- 					<td>楼栋</td> -->
<!-- 					<td><input id="buildingId" name="buildingId" class="easyui-combobox" panelHeight='auto' /></td> -->
<!-- 				</tr> -->
<!-- 				<tr> -->
<!-- 					<td>单元</td> -->
<!-- 					<td><input id="unitId" name="unitId" class="easyui-combobox" panelHeight='auto' /></td> -->
<!-- 					<td>门牌</td> -->
<!-- 					<td><input id="doorId" name="doorId" class="easyui-combobox" panelHeight='auto' required='true' /></td> -->
<!-- 				</tr> -->
				<tr>
					<td>用户类型</td>
					<td><input id="typeId" name="typeId"  panelHeight='auto' required='true' /></td>
					<td>用户姓名</td>
					<td><input id="name" name="name" class="easyui-validatebox" required='true' value="${account.name }"/></td>
				</tr>
				<tr>
					<td>登录名</td>
					<td><input id="loginName" name="loginName" readonly="readonly" class="easyui-validatebox" required='true' value="${account.loginName }" /></td>
					<td>登录密码</td>
					<td><input id="loginPwd" name="loginPwd" class="easyui-validatebox" required='true' value="${account.loginPwd }" /></td>
				</tr>
				<tr>
					<td>手机号码</td>
					<td><input id="mobile" name="mobile" class="easyui-validatebox" value="${account.mobile }"/></td>
					<td>性别</td>
					<td>
						男:<input type="radio" name='sex' value="1" <c:if test="${account.sex==1}"> checked="checked" </c:if> />
						女:<input type="radio" name='sex' value="0" <c:if test="${account.sex==0}"> checked="checked" </c:if> />
					</td>
					
				</tr>
				<tr>
<!-- 					<td>业主</td> -->
<!-- 					<td> -->
<%-- 						是:<input type="radio" name='owner' value="1" <c:if test="${account.owner==1}"> checked="checked" </c:if> /> --%>
<%-- 						否:<input type="radio" name='owner' value="0" <c:if test="${account.owner==0}"> checked="checked" </c:if> /> --%>
<!-- 					</td> -->
					<td>用户头像</td>
					<td colspan="3">
						<div class="file-group">
							<input id="headImage" name="head" type="file"/>
							<input type="hidden" name='headImage' value="${account.headImage}" />
							选择头像					
						</div>
					</td>
				</tr>
				<tr>
					<td colspan="4" align="center">
						<img id="imgView" width="130px" alt="" src="/upload/account/${account.headImage }">
					</td>
				</tr>
			</table>
		</form>
	</div>
</div>